package server

import (
	"fmt"
	"log"
	"net/http"
	"testproject/source/action/test"
	"testproject/source/config"
	"testproject/source/util"
	"testproject/source/websocket"
)

func StartServer() {
	config.Init()
	http.Handle("/", http.FileServer(http.Dir(util.STATIC_PATH_ROOT)))
	http.HandleFunc("/userlogin", test.UserLogin) //用户登录
	http.HandleFunc("/webmsg", test.WebMsg)       //跳转发送消息页面
	http.HandleFunc("/initmessage", test.InitMessage)
	http.HandleFunc("/getuser", test.GetUser) //获取用户信息

	websocket.Start()
	fmt.Println("服务已启动....")
	err := http.ListenAndServe("10.105.99.99:8999", nil)
	if err != nil {
		log.Panicln(err)
	}
}
